package models

import (
	"time"

	"go-admin/common/models"
)

type Advertisements struct {
	models.Model

	UserId      int64     `json:"userId" gorm:"type:bigint;comment:用户ID"`
	CategoryId  int64     `json:"categoryId" gorm:"type:bigint unsigned;comment:类别ID"`
	Title       string    `json:"title" gorm:"type:varchar(100);comment:标题"`
	Description string    `json:"description" gorm:"type:varchar(500);comment:描述"`
	Image       string    `json:"image" gorm:"type:varchar(255);comment:图片"`
	Url         string    `json:"url" gorm:"type:varchar(255);comment:URL"`
	Location    string    `json:"location" gorm:"type:varchar(255);comment:位置"`
	Position    string    `json:"position" gorm:"type:varchar(50);comment:位置"`
	StartTime   time.Time `json:"startTime" gorm:"type:timestamp;comment:开始时间"`
	EndTime     time.Time `json:"endTime" gorm:"type:timestamp;comment:结束时间"`
	Status      string    `json:"status" gorm:"type:varchar(20);comment:状态"`
	Priority    int64     `json:"priority" gorm:"type:int;comment:优先级"`
	Type        string    `json:"type" gorm:"type:varchar(20);comment:类型"`
	Budget      string    `json:"budget" gorm:"type:decimal(10,2);comment:预算"`
	Spent       string    `json:"spent" gorm:"type:decimal(10,2);comment:开销"`
	Impressions int64     `json:"impressions" gorm:"type:int;comment:展示次数"`
	Clicks      int64     `json:"clicks" gorm:"type:int;comment:点击次数"`
	models.ModelTime
	models.ControlBy
}

func (Advertisements) TableName() string {
	return "advertisements"
}

func (e *Advertisements) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *Advertisements) GetId() interface{} {
	return e.Id
}
